{extend name="public/base" /}
{block name="body"}
<div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">文章列表</div>
            <div class="layui-card-body">
                <div class="layui-row zz-row-operate">
                    <div class="zz-operate-btn-group">
                        <a class="layui-btn" title="新增文章" href="{:url('add_document')}">新 增</a>
                        <a class="layui-btn layui-btn-danger zz-btn-delete-all" href="{:url('del_document')}">批量删除</a>
                    </div>
                    <form action="{:url('')}" class="layui-form zz-form-search zz-form zz-form-right">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <select name="category_id">
                                    <option value="0">全部</option>
                                    {volist name="categorylist" id="vo"}
                                    <option  value="{$vo.id}" {$category_id==$vo.id?'selected':''}>{$vo.title}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <input type="text" name="title" placeholder="请输入文章标题" value="{$title}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn btn-search" lay-submit>
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </button>
                        </div>
                    </form>
                </div>

                <div class="layui-form">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th class=" layui-table-col-special" width="18px">
                                <input type="checkbox" lay-filter="zz-checkbox-table" lay-skin="primary">
                            </th>
                            <th>ID</th>
                            <th>标题</th>
                            <th>分类</th>
                            <th>可见性</th>
                            <th>浏览量</th>
                            <th>排序</th>
                            <th>创建时间</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="lists" id="vo"}
                        <tr>
                            <td><input type="checkbox" class="zz-table-chk-item" value="{$vo.id}" lay-skin="primary"></td>
                            <td>{$vo.id}</td>
                            <td>{$vo.title}</td>
                            <td>{$vo.categorytitle}</td>
                            <td>
                                <input type="checkbox" lay-filter="zz-switch-display"  data-href="{:url('set_display?id='.$vo['id'])}" name="display" value="{$vo.display}" {$vo.display==1?'checked':''} lay-skin="switch" lay-text="显示|隐藏">
                            </td>
                            <td>{$vo.view}</td>
                            <td>
                                <form action="{:url('sort')}" method="post" class="layui-form zz-form-datalist" lay-filter="zz-form-{$vo.id}">
                                    <input type="hidden" value="{$vo.id}" name="id">
                                    <input type="text" name="sort" data-source="{$vo.sort}" lay-verify="required|number" autocomplete="off" value="{$vo.sort}" class="layui-input zz-table-input">
                                </form>
                            </td>
                            <td>
                                {:date('Y-m-d H:i:s',$vo.create_time)}
                            </td>
                            <td>
                                {:date('Y-m-d H:i:s',$vo.update_time)}
                            </td>
                            <td>
                                <a href="{:url('edit_document?id='.$vo['id'])}" class="layui-btn layui-btn-xs layui-btn-normal" title="编辑">编辑</a>
                                <a href="{:url('del_document?ids='.$vo['id'])}" class="layui-btn layui-btn-danger layui-btn-xs confirm ajax-post">删除</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                    {$page|raw}
                </div>
            </div>
        </div>
    </div>
</div>

{/block}